home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / sun / volume1 / calentool / patch4c < prev    next >
Encoding:
Internet Message Format  |  1989-10-26  |  43.7 KB

  1. Subject:  v01i074:  Patches for calentool (to patchlevel 4), Part03/04
  2. Newsgroups: comp.sources.sun
  3. Approved: mcgrew@aramis.rutgers.edu
  4.  
  5. Submitted-by: Bill Randle <billr@saab.cna.tek.com>
  6. Posting-number: Volume 1, Issue 74
  7. Archive-name: calentool/patch4c
  8.  
  9. #! /bin/sh
  10. # This is a shell archive.  Remove anything before this line, then unpack
  11. # it by saving it into a file and typing "sh file".  To overwrite existing
  12. # files, type "sh file -c".  You can also feed this as standard input via
  13. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  14. # will see the following message at the end:
  15. #        "End of archive 3 (of 4)."
  16. # Contents:  patches04c pcal.c
  17. # Wrapped by billr@saab on Tue Sep 19 06:30:14 1989
  18. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  19. if test -f 'patches04c' -a "${1}" != "-c" ; then 
  20.   echo shar: Will not clobber existing file \"'patches04c'\"
  21. else
  22. echo shar: Extracting \"'patches04c'\" \(26414 characters\)
  23. sed "s/^X//" >'patches04c' <<'END_OF_FILE'
  24. X*** /tmp/,RCSt1a05582    Wed Jul 19 20:46:15 1989
  25. X--- ras2ps.c    Wed Jul 19 20:31:04 1989
  26. X***************
  27. X*** 1,5
  28. X  /*
  29. X!  * $Header: ras2ps.c,v 2.1 89/05/09 14:19:40 billr Exp $
  30. X   */
  31. X  /*
  32. X   * ras2ps - convert Sun raster file to RLL Postscript file
  33. X
  34. X--- 1,5 -----
  35. X  /*
  36. X!  * $Header: ras2ps.c,v 2.2 89/07/19 20:30:25 billr Exp $
  37. X   */
  38. X  /*
  39. X   * ras2ps - convert Sun raster file to RLL Postscript file
  40. X***************
  41. X*** 91,96
  42. X       sizey = 10.0;
  43. X       transx = transy = 0.5;
  44. X       inv = 0;
  45. X       ofile = outfile;
  46. X       
  47. X       if (pr_load_header(infile, &rh) != 0)
  48. X
  49. X--- 91,97 -----
  50. X       sizey = 10.0;
  51. X       transx = transy = 0.5;
  52. X       inv = 0;
  53. X+      rotate = 90.0;
  54. X       ofile = outfile;
  55. X       
  56. X       if (pr_load_header(infile, &rh) != 0)
  57. X*** /tmp/,RCSt1a05587    Wed Jul 19 20:46:18 1989
  58. X--- riseset.c    Wed Jul 19 20:31:30 1989
  59. X***************
  60. X*** 1,5
  61. X  /*
  62. X!  * $Header: riseset.c,v 2.1 89/05/09 14:19:49 billr Exp $
  63. X   */
  64. X  /*
  65. X   * riseset.c
  66. X
  67. X--- 1,5 -----
  68. X  /*
  69. X!  * $Header: riseset.c,v 2.2 89/07/19 20:31:05 billr Exp $
  70. X   */
  71. X  /*
  72. X   * riseset.c
  73. X***************
  74. X*** 117,123
  75. X  #ifdef LONG_DEGREES
  76. X      Local = - Longitude/15.;    /* Local apparent time correction */
  77. X  #else
  78. X!     Local = (double)(-tzp.minuteswest * 60.);
  79. X  #endif
  80. X  
  81. X      sprintf(riseset_buf[B_GMT], "%.24s GMT", gmctime(&UTC));
  82. X
  83. X--- 117,123 -----
  84. X  #ifdef LONG_DEGREES
  85. X      Local = - Longitude/15.;    /* Local apparent time correction */
  86. X  #else
  87. X!     Local = (double)(-tzp.tz_minuteswest * 60.);
  88. X  #endif
  89. X  
  90. X      sprintf(riseset_buf[B_GMT], "%.24s GMT", gmctime(&UTC));
  91. X*** /tmp/,RCSt1a05592    Wed Jul 19 20:46:21 1989
  92. X--- tool.c    Wed Jul 19 20:31:39 1989
  93. X***************
  94. X*** 1,5
  95. X  /*
  96. X!  * $Header: tool.c,v 2.1 89/05/09 14:23:08 billr Exp $
  97. X   */
  98. X  /*
  99. X   * tool.c
  100. X
  101. X--- 1,5 -----
  102. X  /*
  103. X!  * $Header: tool.c,v 2.2 89/07/19 20:31:31 billr Exp $
  104. X   */
  105. X  /*
  106. X   * tool.c
  107. X***************
  108. X*** 29,34
  109. X  #include <sys/file.h>
  110. X  #include "ct.h"
  111. X  
  112. X  extern struct tm current;
  113. X  extern Frame frame;
  114. X  extern int working_msg;
  115. X
  116. X--- 29,41 -----
  117. X  #include <sys/file.h>
  118. X  #include "ct.h"
  119. X  
  120. X+ /*
  121. X+  * define standard B/W monochrome colors as defaults in case we're running
  122. X+  * on a color system with the monochrome colors set differently
  123. X+  */
  124. X+ #define FG_DEFAULT  { 0, 0, 0 }     /* black */
  125. X+ #define BG_DEFAULT  { 255, 255, 255 }   /* white */
  126. X+ 
  127. X  extern struct tm current;
  128. X  extern Frame frame;
  129. X  extern int working_msg;
  130. X***************
  131. X*** 74,79
  132. X  #ifndef NO_SUN_MOON
  133. X  Canvas scanvas, mcanvas;
  134. X  Panel_item sdate_pi, mdate_pi;
  135. X  #endif
  136. X  Frame prompt_frame = 0;
  137. X  Pixrect *morebutton;
  138. X
  139. X--- 81,88 -----
  140. X  #ifndef NO_SUN_MOON
  141. X  Canvas scanvas, mcanvas;
  142. X  Panel_item sdate_pi, mdate_pi;
  143. X+ static struct singlecolor       fg_default = FG_DEFAULT;
  144. X+ static struct singlecolor       bg_default = BG_DEFAULT;
  145. X  #endif
  146. X  Frame prompt_frame = 0;
  147. X  Pixrect *morebutton;
  148. X***************
  149. X*** 264,271
  150. X              PANEL_ITEM_Y, ATTR_ROW(2)-2,
  151. X                          0);
  152. X  
  153. X!     next_menu = menu_create(MENU_STRINGS,
  154. X!             "Tommorow", "Next Week", "Next Month", "Next Year", 0,
  155. X              0);
  156. X      
  157. X      next_pi = panel_create_item(panel, PANEL_BUTTON,
  158. X
  159. X--- 273,280 -----
  160. X              PANEL_ITEM_Y, ATTR_ROW(2)-2,
  161. X                          0);
  162. X  
  163. X!     next_menu = menu_create(MENU_STRINGS, "Tomorrow",
  164. X!             "Next Week", "Next Month", "Next Year", 0,
  165. X              0);
  166. X      
  167. X      next_pi = panel_create_item(panel, PANEL_BUTTON,
  168. X***************
  169. X*** 445,451
  170. X          }
  171. X      } else
  172. X          bigfont = pf_open("/usr/lib/fonts/fixedwidthfonts/gallant.r.10");
  173. X!     /* font for displaying time under the icon */
  174. X      sfont = pf_open("/usr/lib/fonts/fixedwidthfonts/screen.r.7");
  175. X  }
  176. X  
  177. X
  178. X--- 454,466 -----
  179. X          }
  180. X      } else
  181. X          bigfont = pf_open("/usr/lib/fonts/fixedwidthfonts/gallant.r.10");
  182. X!     /* double check */
  183. X!     if (bigfont == NULL) {
  184. X!         err_rpt("unable to open large size font", NON_FATAL);
  185. X!         bigfont = pw_pfsysopen();
  186. X!     }
  187. X! 
  188. X!     /* font for displaying time under the icon and days under moon */
  189. X      sfont = pf_open("/usr/lib/fonts/fixedwidthfonts/screen.r.7");
  190. X  }
  191. X  
  192. X***************
  193. X*** 761,766
  194. X                  WIN_SHOW, TRUE, WIN_X, ATTR_COL(12),
  195. X                  FRAME_LABEL, "Lunar Data",
  196. X                  FRAME_SHOW_LABEL, TRUE,
  197. X                  FRAME_DONE_PROC, mframe_done,
  198. X                  WIN_ERROR_MSG, "Can't create moon data frame.",
  199. X                  0);
  200. X
  201. X--- 776,784 -----
  202. X                  WIN_SHOW, TRUE, WIN_X, ATTR_COL(12),
  203. X                  FRAME_LABEL, "Lunar Data",
  204. X                  FRAME_SHOW_LABEL, TRUE,
  205. X+                 FRAME_INHERIT_COLORS, TRUE,
  206. X+                 FRAME_FOREGROUND_COLOR, &fg_default,
  207. X+                 FRAME_BACKGROUND_COLOR, &bg_default,
  208. X                  FRAME_DONE_PROC, mframe_done,
  209. X                  WIN_ERROR_MSG, "Can't create moon data frame.",
  210. X                  0);
  211. X*** /tmp/,RCSt1a05597    Wed Jul 19 20:46:26 1989
  212. X--- utils.c    Wed Jul 19 20:32:25 1989
  213. X***************
  214. X*** 1,5
  215. X  /*
  216. X!  * $Header: utils.c,v 2.2 89/05/16 16:30:18 billr Exp $
  217. X   */
  218. X  /*
  219. X   * utils.c
  220. X
  221. X--- 1,5 -----
  222. X  /*
  223. X!  * $Header: utils.c,v 2.3 89/07/19 20:31:40 billr Exp $
  224. X   */
  225. X  /*
  226. X   * utils.c
  227. X***************
  228. X*** 729,734
  229. X  /*
  230. X   * Print today's appointments to stdout or mail (useful if we only have an ASCII
  231. X   * terminal connected to our Sun). Invoked by the "-p", "-P" or "-m" options.
  232. X   */
  233. X  print_apts(level)
  234. X  int level;
  235. X
  236. X--- 729,735 -----
  237. X  /*
  238. X   * Print today's appointments to stdout or mail (useful if we only have an ASCII
  239. X   * terminal connected to our Sun). Invoked by the "-p", "-P" or "-m" options.
  240. X+  * Month information is only printed as PostScript output.
  241. X   */
  242. X  print_apts(which, dest)
  243. X  int which, dest;
  244. X***************
  245. X*** 730,737
  246. X   * Print today's appointments to stdout or mail (useful if we only have an ASCII
  247. X   * terminal connected to our Sun). Invoked by the "-p", "-P" or "-m" options.
  248. X   */
  249. X! print_apts(level)
  250. X! int level;
  251. X  {
  252. X      int i;
  253. X      FILE *output, *popen();
  254. X
  255. X--- 731,738 -----
  256. X   * terminal connected to our Sun). Invoked by the "-p", "-P" or "-m" options.
  257. X   * Month information is only printed as PostScript output.
  258. X   */
  259. X! print_apts(which, dest)
  260. X! int which, dest;
  261. X  {
  262. X      int i;
  263. X      FILE *output, *pfp, *popen();
  264. X***************
  265. X*** 734,742
  266. X  int level;
  267. X  {
  268. X      int i;
  269. X!     FILE *output, *popen();
  270. X!     char cmd[80], *name, *cuserid(), *format_appt();
  271. X!     struct appt_entry tmp_apt, *sptr;
  272. X  
  273. X      fix_current_day();
  274. X      get_day_appts();
  275. X
  276. X--- 735,742 -----
  277. X  int which, dest;
  278. X  {
  279. X      int i;
  280. X!     FILE *output, *pfp, *popen();
  281. X!     char cmd[80], *name, *cuserid();
  282. X  
  283. X      if (dest == DST_MAIL)
  284. X          /* only mail one day's appts */
  285. X***************
  286. X*** 738,743
  287. X      char cmd[80], *name, *cuserid(), *format_appt();
  288. X      struct appt_entry tmp_apt, *sptr;
  289. X  
  290. X      fix_current_day();
  291. X      get_day_appts();
  292. X      if (level == 2) {
  293. X
  294. X--- 738,746 -----
  295. X      FILE *output, *pfp, *popen();
  296. X      char cmd[80], *name, *cuserid();
  297. X  
  298. X+     if (dest == DST_MAIL)
  299. X+         /* only mail one day's appts */
  300. X+         which = PRI_DAY;
  301. X      fix_current_day();
  302. X      if ((which == PRI_DAY) && !get_day_appts())
  303. X          return;    /* nothing to show */
  304. X***************
  305. X*** 739,746
  306. X      struct appt_entry tmp_apt, *sptr;
  307. X  
  308. X      fix_current_day();
  309. X!     get_day_appts();
  310. X!     if (level == 2) {
  311. X          if (mailto != NULL) {
  312. X              name = mailto;
  313. X          } else if ((name = cuserid(NULL)) == NULL) {
  314. X
  315. X--- 742,750 -----
  316. X          /* only mail one day's appts */
  317. X          which = PRI_DAY;
  318. X      fix_current_day();
  319. X!     if ((which == PRI_DAY) && !get_day_appts())
  320. X!         return;    /* nothing to show */
  321. X!     if (dest == DST_MAIL) {
  322. X          if (mailto != NULL) {
  323. X              name = mailto;
  324. X          } else if ((name = cuserid(NULL)) == NULL) {
  325. X***************
  326. X*** 753,759
  327. X          output = stdout;
  328. X      }
  329. X      
  330. X!     fprintf(output,"\n\t*** Appointments for %s %s %d, 19%02d ***\n\n", 
  331. X          daynames[current.tm_wday], monthnames[current.tm_mon],
  332. X          current.tm_mday, current.tm_year);
  333. X      
  334. X
  335. X--- 757,794 -----
  336. X          output = stdout;
  337. X      }
  338. X      
  339. X!     if (which == PRI_DAY || which == PRI_DAY_XNOTES) {
  340. X!         print_one_day(which, output);
  341. X!     } else if (which == PRI_WEEK || which == PRI_WEEK_XNOTES) {
  342. X!         current.tm_mday -= current.tm_wday; /* Sunday of this week */
  343. X!         fix_current_day();
  344. X!         if (nr_weekdays < 7) {
  345. X!             current.tm_mday++;
  346. X!             fix_current_day();
  347. X!         }
  348. X!         for (i=0;i<nr_weekdays;i++) {
  349. X!             if (get_day_appts())
  350. X!                 print_one_day(which, output);
  351. X!             current.tm_mday++;
  352. X!             fix_current_day();
  353. X!         }
  354. X!     } else if (which == PRI_MONTH || which == PRI_MONTH_XNOTES) {
  355. X!         print_month(output, (which == PRI_MONTH_XNOTES ? TRUE : FALSE));
  356. X!     }
  357. X!     fflush(output);
  358. X!     if (dest == DST_MAIL)
  359. X!         pclose(output);
  360. X! }
  361. X! 
  362. X! print_one_day(which, output)
  363. X! int which;
  364. X! FILE *output;
  365. X! {
  366. X!     int i;
  367. X!     struct appt_entry tmp_apt;
  368. X!     char *format_appt();
  369. X! 
  370. X!     fprintf(output,"\n\t*** Appointments for %s %s %d, %d ***\n\n", 
  371. X          daynames[current.tm_wday], monthnames[current.tm_mon],
  372. X          current.tm_mday, current.tm_year+1900);
  373. X  
  374. X***************
  375. X*** 755,762
  376. X      
  377. X      fprintf(output,"\n\t*** Appointments for %s %s %d, 19%02d ***\n\n", 
  378. X          daynames[current.tm_wday], monthnames[current.tm_mon],
  379. X!         current.tm_mday, current.tm_year);
  380. X!     
  381. X      for (i=0; i<N_SLOTS; i++) {
  382. X          if (i == n_tslots)
  383. X              /* start of notes section */
  384. X
  385. X--- 790,797 -----
  386. X  
  387. X      fprintf(output,"\n\t*** Appointments for %s %s %d, %d ***\n\n", 
  388. X          daynames[current.tm_wday], monthnames[current.tm_mon],
  389. X!         current.tm_mday, current.tm_year+1900);
  390. X! 
  391. X      for (i=0; i<N_SLOTS; i++) {
  392. X          if (i == n_tslots)
  393. X              /* start of notes section */
  394. X***************
  395. X*** 765,771
  396. X              /* at least one appt here */
  397. X              slots[i].cur_appt = slots[i].first;
  398. X              do {
  399. X!                 if (level == 3 && ((slots[i].cur_appt->flags & MARKED_NOTE) == MARKED_NOTE))
  400. X                      continue;
  401. X                  if (chk_deleted(i))
  402. X                      continue;
  403. X
  404. X--- 800,806 -----
  405. X              /* at least one appt here */
  406. X              slots[i].cur_appt = slots[i].first;
  407. X              do {
  408. X!                 if ((which & PRI_XNOTES) && ((slots[i].cur_appt->flags & MARKED_NOTE) == MARKED_NOTE))
  409. X                      continue;
  410. X                  if (chk_deleted(i))
  411. X                      continue;
  412. X***************
  413. X*** 783,791
  414. X          for (i=0; i<findex; i++)
  415. X              fprintf(output, "%s\n", format_appt(&future[i]));
  416. X      }
  417. X-     fflush(output);
  418. X-     if (level == 2)
  419. X-         pclose(output);
  420. X  }
  421. X  
  422. X  /*
  423. X
  424. X--- 818,823 -----
  425. X          for (i=0; i<findex; i++)
  426. X              fprintf(output, "%s\n", format_appt(&future[i]));
  427. X      }
  428. X  }
  429. X  
  430. X  /*
  431. X***************
  432. X*** 989,994
  433. X  
  434. X  /*
  435. X   * convert appt entry to ASCII string for display with time and msg
  436. X   */
  437. X  char *
  438. X  format_appt_nd(appt)
  439. X
  440. X--- 1021,1027 -----
  441. X  
  442. X  /*
  443. X   * convert appt entry to ASCII string for display with time and msg
  444. X+  *    if <esc_parens> is true then put '\' in front of parens (for Ps)
  445. X   */
  446. X  char *
  447. X  format_appt_nd(appt, esc_parens)
  448. X***************
  449. X*** 991,997
  450. X   * convert appt entry to ASCII string for display with time and msg
  451. X   */
  452. X  char *
  453. X! format_appt_nd(appt)
  454. X  struct appt_entry *appt;
  455. X  {
  456. X      int e_hour, e_minutes, duration;
  457. X
  458. X--- 1024,1030 -----
  459. X   *    if <esc_parens> is true then put '\' in front of parens (for Ps)
  460. X   */
  461. X  char *
  462. X! format_appt_nd(appt, esc_parens)
  463. X  struct appt_entry *appt;
  464. X  int    esc_parens;
  465. X  {
  466. X***************
  467. X*** 993,998
  468. X  char *
  469. X  format_appt_nd(appt)
  470. X  struct appt_entry *appt;
  471. X  {
  472. X      int e_hour, e_minutes, duration;
  473. X      struct tm Save;
  474. X
  475. X--- 1026,1032 -----
  476. X  char *
  477. X  format_appt_nd(appt, esc_parens)
  478. X  struct appt_entry *appt;
  479. X+ int    esc_parens;
  480. X  {
  481. X      int e_hour, e_minutes, duration;
  482. X      char *p, *q;
  483. X***************
  484. X*** 995,1000
  485. X  struct appt_entry *appt;
  486. X  {
  487. X      int e_hour, e_minutes, duration;
  488. X      struct tm Save;
  489. X  
  490. X      if (appt->arrows > 0) {
  491. X
  492. X--- 1029,1035 -----
  493. X  int    esc_parens;
  494. X  {
  495. X      int e_hour, e_minutes, duration;
  496. X+     char *p, *q;
  497. X      struct tm Save;
  498. X  
  499. X      if (appt->arrows > 0) {
  500. X***************
  501. X*** 1010,1019
  502. X          ++e_hour;
  503. X      }
  504. X  
  505. X!     if (appt->flags & A_NOTE) {
  506. X!         /* note */
  507. X!         sprintf(strbuf,"%s", appt->str);
  508. X!     } else
  509. X          /* standard appointment */
  510. X          sprintf(strbuf,"%2d:%02d to %2d:%02d   %s",
  511. X              appt->hour, appt->minute, e_hour, e_minutes, appt->str);
  512. X
  513. X--- 1045,1052 -----
  514. X          ++e_hour;
  515. X      }
  516. X  
  517. X!     strbuf[0] = '\0';
  518. X!     if (!(appt->flags & A_NOTE))
  519. X          /* standard appointment */
  520. X          sprintf(strbuf,"%2d:%02d to %2d:%02d  ",
  521. X              appt->hour, appt->minute, e_hour, e_minutes);
  522. X***************
  523. X*** 1015,1022
  524. X          sprintf(strbuf,"%s", appt->str);
  525. X      } else
  526. X          /* standard appointment */
  527. X!         sprintf(strbuf,"%2d:%02d to %2d:%02d   %s",
  528. X!             appt->hour, appt->minute, e_hour, e_minutes, appt->str);
  529. X  
  530. X      return(strbuf);
  531. X  }
  532. X
  533. X--- 1048,1077 -----
  534. X      strbuf[0] = '\0';
  535. X      if (!(appt->flags & A_NOTE))
  536. X          /* standard appointment */
  537. X!         sprintf(strbuf,"%2d:%02d to %2d:%02d  ",
  538. X!             appt->hour, appt->minute, e_hour, e_minutes);
  539. X!     p = appt->str;
  540. X!     q = strbuf + strlen(strbuf);
  541. X!     while (*p) {
  542. X!         if (esc_parens)
  543. X!             switch (*p) {
  544. X!                 /* ignore these */
  545. X!                 case '\b':
  546. X!                 case '\f':
  547. X!                 case '\n':
  548. X!                 case '\r':
  549. X!                 case '\t':
  550. X!                     break;
  551. X!                 /* escape these for PostScript */
  552. X!                 case '\\':
  553. X!                 case '(':
  554. X!                 case ')':
  555. X!                     *q++ = '\\';
  556. X!                     break;
  557. X!             }
  558. X!         *q++ = *p++;
  559. X!     }
  560. X!     *q = '\0';
  561. X  
  562. X      return(strbuf);
  563. X  }
  564. X***************
  565. X*** 1150,1156
  566. X                  } else
  567. X                      err_rpt("can't open tmp ps file", NON_FATAL);
  568. X              } else {
  569. X!                 sprintf(prntcmd, "%s %s", printer, rasfile);
  570. X                  system(prntcmd);
  571. X              }
  572. X              pr_destroy(save_pr);
  573. X
  574. X--- 1205,1211 -----
  575. X                  } else
  576. X                      err_rpt("can't open tmp ps file", NON_FATAL);
  577. X              } else {
  578. X!                 sprintf(prntcmd, "%s -v %s", printer, rasfile);
  579. X                  system(prntcmd);
  580. X              }
  581. X              pr_destroy(save_pr);
  582. X***************
  583. X*** 1162,1168
  584. X              err_rpt("only PostScript output available for month printout", NON_FATAL);
  585. X          } else {
  586. X              if ((pfp = fopen(psfile, "w")) != NULL) {
  587. X!                 print_month(pfp);
  588. X                  fclose(pfp);
  589. X                  sprintf(prntcmd, "%s %s", printer, psfile);
  590. X                  system(prntcmd);
  591. X
  592. X--- 1217,1223 -----
  593. X              err_rpt("only PostScript output available for month printout", NON_FATAL);
  594. X          } else {
  595. X              if ((pfp = fopen(psfile, "w")) != NULL) {
  596. X!                 print_month(pfp, FALSE);
  597. X                  fclose(pfp);
  598. X                  sprintf(prntcmd, "%s %s", printer, psfile);
  599. X                  system(prntcmd);
  600. X*** /tmp/,RCSt1a06124    Tue Sep 19 06:10:02 1989
  601. X--- version.c    Tue Sep 19 06:09:35 1989
  602. X***************
  603. X*** 1,5
  604. X  /*
  605. X!  * $Header: version.c,v 2.3 89/05/16 16:31:58 billr Exp $
  606. X   */
  607. X  /*
  608. X   * version.c - current version of calentool program
  609. X
  610. X--- 1,5 -----
  611. X  /*
  612. X!  * $Header: version.c,v 2.5 89/09/19 06:09:07 billr Exp $
  613. X   */
  614. X  /*
  615. X   * version.c - current version of calentool program
  616. X***************
  617. X*** 24,27
  618. X   * notice remains intact.
  619. X   */
  620. X  
  621. X! char version[] = "Calendar Tool V2.1p2";
  622. X
  623. X--- 24,27 -----
  624. X   * notice remains intact.
  625. X   */
  626. X  
  627. X! char version[] = "Calendar Tool V2.1p4";
  628. X*** /tmp/,RCSt1a05609    Wed Jul 19 20:46:32 1989
  629. X--- wpaint.c    Wed Jul 19 20:32:47 1989
  630. X***************
  631. X*** 1,5
  632. X  /*
  633. X!  * $Header: wpaint.c,v 2.1 89/05/09 14:20:03 billr Exp $
  634. X   */
  635. X  /*
  636. X   * wpaint.c
  637. X
  638. X--- 1,5 -----
  639. X  /*
  640. X!  * $Header: wpaint.c,v 2.2 89/07/19 20:32:38 billr Exp $
  641. X   */
  642. X  /*
  643. X   * wpaint.c
  644. X***************
  645. X*** 69,75
  646. X      draw_week_appts();
  647. X      pw_batch_off(main_pixwin);
  648. X      current = Save;
  649. X!     get_day_appts();
  650. X      working(FALSE);
  651. X      unlock_cursors();
  652. X  }
  653. X
  654. X--- 69,75 -----
  655. X      draw_week_appts();
  656. X      pw_batch_off(main_pixwin);
  657. X      current = Save;
  658. X!     (void)get_day_appts();
  659. X      working(FALSE);
  660. X      unlock_cursors();
  661. X  }
  662. X*** /tmp/,RCSt1a05614    Wed Jul 19 20:46:33 1989
  663. X--- Makefile    Wed Jul 19 20:33:12 1989
  664. X***************
  665. X*** 1,4
  666. X! # $Header: Makefile,v 2.1 89/05/09 14:29:00 billr Exp $
  667. X  #
  668. X  # make sure LIBDIR here matches DATELIB_DIR in ct.h (or use -D)
  669. X  BINDIR = /usr/local/bin
  670. X
  671. X--- 1,4 -----
  672. X! # $Header: Makefile,v 2.2 89/07/19 20:32:48 billr Exp $
  673. X  #
  674. X  #DATELIB_DIR  Directory containing the Date Library
  675. X  #PRINT_CMD    Command to send postscript to appropriate printer
  676. X***************
  677. X*** 1,5
  678. X  # $Header: Makefile,v 2.1 89/05/09 14:29:00 billr Exp $
  679. X  #
  680. X  # make sure LIBDIR here matches DATELIB_DIR in ct.h (or use -D)
  681. X  BINDIR = /usr/local/bin
  682. X  LIBDIR = /usr/local/lib/calentool
  683. X
  684. X--- 1,25 -----
  685. X  # $Header: Makefile,v 2.2 89/07/19 20:32:48 billr Exp $
  686. X  #
  687. X+ #DATELIB_DIR  Directory containing the Date Library
  688. X+ #PRINT_CMD    Command to send postscript to appropriate printer
  689. X+ #NR_WEEKDAYS  Define to number of days in week to display (5-7)
  690. X+ #START_HOUR   What is first hour of day to display
  691. X+ #END_HOUR     What is last hour of day to display
  692. X+ #START_YEAR   What is first year of calendar to display
  693. X+ #NR_YEARS     How many years to display.
  694. X+ #UPDATE_RATE  How often to perform updates (second or minute)?
  695. X+ #APPT_CHECK_LIMIT What limits to check for appointments (see ct.h)
  696. X+ #
  697. X+ #NO_PRINTER   No printing is supported
  698. X+ #RASTER_ONLY  Define if no PostScript printer available.
  699. X+ #NO_HOLIDAYS  No holiday display is supported
  700. X+ #NO_SUN_MOON  No sun and moon phase info is supported
  701. X+ #
  702. X+ #BINDIR       Where to install binaries
  703. X+ #LIBDIR       Where to install date files and utility binaries
  704. X+ #MANDIR       Where to install man pages
  705. X+ #DEFSDIR      Where to install calentool default values
  706. X+ #
  707. X  # make sure LIBDIR here matches DATELIB_DIR in ct.h (or use -D)
  708. X  BINDIR = /usr/local/bin
  709. X  LIBDIR = /usr/local/lib/calentool
  710. X***************
  711. X*** 7,12
  712. X  DEFSDIR = /usr/lib/defaults
  713. X  MANEXT = l
  714. X  
  715. X  DEFINES=  #-DDATELIB_DIR=\"./dates\" -DSTART_HOUR=7 -DEND_HOUR=19 -DSTART_YEAR=88
  716. X  CFLAGS=    -O ${DEFINES}
  717. X  LIBS=    -lsuntool -lsunwindow -lpixrect -lm
  718. X
  719. X--- 27,33 -----
  720. X  DEFSDIR = /usr/lib/defaults
  721. X  MANEXT = l
  722. X  
  723. X+ CC = cc
  724. X  DEFINES=  #-DDATELIB_DIR=\"./dates\" -DSTART_HOUR=7 -DEND_HOUR=19 -DSTART_YEAR=88
  725. X  CFLAGS=    -g ${DEFINES}
  726. X  LIBS=    -lsuntool -lsunwindow -lpixrect -lm
  727. X***************
  728. X*** 8,14
  729. X  MANEXT = l
  730. X  
  731. X  DEFINES=  #-DDATELIB_DIR=\"./dates\" -DSTART_HOUR=7 -DEND_HOUR=19 -DSTART_YEAR=88
  732. X! CFLAGS=    -O ${DEFINES}
  733. X  LIBS=    -lsuntool -lsunwindow -lpixrect -lm
  734. X  
  735. X  DATEFILES= dates/README dates/celtic dates/events dates/lives\
  736. X
  737. X--- 29,35 -----
  738. X  
  739. X  CC = cc
  740. X  DEFINES=  #-DDATELIB_DIR=\"./dates\" -DSTART_HOUR=7 -DEND_HOUR=19 -DSTART_YEAR=88
  741. X! CFLAGS=    -g ${DEFINES}
  742. X  LIBS=    -lsuntool -lsunwindow -lpixrect -lm
  743. X  
  744. X  DATEFILES= dates/README dates/celtic dates/computing dates/events\
  745. X***************
  746. X*** 11,19
  747. X  CFLAGS=    -O ${DEFINES}
  748. X  LIBS=    -lsuntool -lsunwindow -lpixrect -lm
  749. X  
  750. X! DATEFILES= dates/README dates/celtic dates/events dates/lives\
  751. X!      dates/lotr dates/nature dates/popcult\
  752. X!      dates/usa_holiday dates/usa_other dates/usa_states dates/world
  753. X  SRCS=    calentool.c datelib.o devent.c dpaint.c event.c holidays.c\
  754. X       init.c moon.c mpaint.c notify.c ras2ps.c riseset.c tool.c utils.c\
  755. X       version.c wevent.c wpaint.c ypaint.c
  756. X
  757. X--- 32,41 -----
  758. X  CFLAGS=    -g ${DEFINES}
  759. X  LIBS=    -lsuntool -lsunwindow -lpixrect -lm
  760. X  
  761. X! DATEFILES= dates/README dates/celtic dates/computing dates/events\
  762. X!      dates/lives dates/lotr dates/nature dates/popcult\
  763. X!      dates/usa_holiday dates/usa_other dates/usa_states dates/world\
  764. X!      dates/gdead dates/space
  765. X  SRCS=    calentool.c datelib.o devent.c dpaint.c event.c holidays.c\
  766. X       init.c moon.c mpaint.c notify.c pcal.c ras2ps.c riseset.c tool.c utils.c\
  767. X       version.c wevent.c wpaint.c ypaint.c
  768. X***************
  769. X*** 15,21
  770. X       dates/lotr dates/nature dates/popcult\
  771. X       dates/usa_holiday dates/usa_other dates/usa_states dates/world
  772. X  SRCS=    calentool.c datelib.o devent.c dpaint.c event.c holidays.c\
  773. X!      init.c moon.c mpaint.c notify.c ras2ps.c riseset.c tool.c utils.c\
  774. X       version.c wevent.c wpaint.c ypaint.c
  775. X  INCLUDES= ct.h event.h paint.h patchlevel.h riseset.h
  776. X  OBJS=    calentool.o datelib.o devent.o dpaint.o event.o holidays.o\
  777. X
  778. X--- 37,43 -----
  779. X       dates/usa_holiday dates/usa_other dates/usa_states dates/world\
  780. X       dates/gdead dates/space
  781. X  SRCS=    calentool.c datelib.o devent.c dpaint.c event.c holidays.c\
  782. X!      init.c moon.c mpaint.c notify.c pcal.c ras2ps.c riseset.c tool.c utils.c\
  783. X       version.c wevent.c wpaint.c ypaint.c
  784. X  INCLUDES= ct.h event.h paint.h patchlevel.h riseset.h
  785. X  OBJS=    calentool.o datelib.o devent.o dpaint.o event.o holidays.o\
  786. X***************
  787. X*** 19,25
  788. X       version.c wevent.c wpaint.c ypaint.c
  789. X  INCLUDES= ct.h event.h paint.h patchlevel.h riseset.h
  790. X  OBJS=    calentool.o datelib.o devent.o dpaint.o event.o holidays.o\
  791. X!      init.o moon.o mpaint.o notify.o ras2ps.o riseset.o tool.o utils.o\
  792. X       version.o wevent.o wpaint.o ypaint.o
  793. X  
  794. X  all: calentool conv_tools
  795. X
  796. X--- 41,47 -----
  797. X       version.c wevent.c wpaint.c ypaint.c
  798. X  INCLUDES= ct.h event.h paint.h patchlevel.h riseset.h
  799. X  OBJS=    calentool.o datelib.o devent.o dpaint.o event.o holidays.o\
  800. X!      init.o moon.o mpaint.o notify.o pcal.o ras2ps.o riseset.o tool.o utils.o\
  801. X       version.o wevent.o wpaint.o ypaint.o
  802. X  
  803. X  all: calentool conv_tools
  804. X***************
  805. X*** 26,32
  806. X  
  807. X  # the main program
  808. X  calentool: ${OBJS}
  809. X!     cc ${CFLAGS} -o calentool ${OBJS} ${LIBS}
  810. X  
  811. X  calentool.o: calentool.c ct.h std.icon rev.icon nap.icon
  812. X  datelib.o: datelib.c
  813. X
  814. X--- 48,54 -----
  815. X  
  816. X  # the main program
  817. X  calentool: ${OBJS}
  818. X!     ${CC} ${CFLAGS} -o calentool ${OBJS} ${LIBS}
  819. X  
  820. X  calentool.o: calentool.c ct.h std.icon rev.icon nap.icon
  821. X  datelib.o: datelib.c
  822. X***************
  823. X*** 38,43
  824. X  mpaint.o: mpaint.c ct.h paint.h
  825. X  notify.o: notify.c ct.h
  826. X  event.o: event.c ct.h event.h
  827. X  ras2ps.o: ras2ps.c
  828. X  riseset.o: riseset.h
  829. X  tool.o: tool.c ct.h
  830. X
  831. X--- 60,66 -----
  832. X  mpaint.o: mpaint.c ct.h paint.h
  833. X  notify.o: notify.c ct.h
  834. X  event.o: event.c ct.h event.h
  835. X+ pcal.o:    pcal.c ct.h
  836. X  ras2ps.o: ras2ps.c
  837. X  riseset.o: riseset.h
  838. X  tool.o: tool.c ct.h
  839. X***************
  840. X*** 69,76
  841. X      install -s month2ct ${LIBDIR}
  842. X      install -s mt2ct ${LIBDIR}
  843. X      install -c -m 444 mt2ct.1 ${MANDIR}/mt2ct.${MANEXT}
  844. X!     cd ${MANDIR}; ln -s mt2ct.${MANEXT} cal2ct.${MANEXT};
  845. X!     cd ${MANDIR}; ln -s mt2ct.${MANEXT} month2ct.${MANEXT};
  846. X  
  847. X  clean:
  848. X      rm -f *.o *.BAK core
  849. X
  850. X--- 92,103 -----
  851. X      install -s month2ct ${LIBDIR}
  852. X      install -s mt2ct ${LIBDIR}
  853. X      install -c -m 444 mt2ct.1 ${MANDIR}/mt2ct.${MANEXT}
  854. X!     cd ${MANDIR}; \
  855. X!         rm -f cal2ct.${MANEXT}; \
  856. X!         ln -s mt2ct.${MANEXT} cal2ct.${MANEXT};
  857. X!     cd ${MANDIR}; \
  858. X!         rm -f month2ct.${MANEXT}; \
  859. X!         ln -s mt2ct.${MANEXT} month2ct.${MANEXT};
  860. X  
  861. X  clean:
  862. X      rm -f *.o *.BAK core *~ #*#
  863. X***************
  864. X*** 73,77
  865. X      cd ${MANDIR}; ln -s mt2ct.${MANEXT} month2ct.${MANEXT};
  866. X  
  867. X  clean:
  868. X!     rm -f *.o *.BAK core
  869. X  
  870. X
  871. X--- 100,106 -----
  872. X          ln -s mt2ct.${MANEXT} month2ct.${MANEXT};
  873. X  
  874. X  clean:
  875. X!     rm -f *.o *.BAK core *~ #*#
  876. X  
  877. X  veryclean:
  878. X      rm -f calentool cal2ct month2ct mt2ct *.o *.BAK core *~ #*#
  879. X***************
  880. X*** 75,77
  881. X  clean:
  882. X      rm -f *.o *.BAK core
  883. X  
  884. X
  885. X--- 102,112 -----
  886. X  clean:
  887. X      rm -f *.o *.BAK core *~ #*#
  888. X  
  889. X+ veryclean:
  890. X+     rm -f calentool cal2ct month2ct mt2ct *.o *.BAK core *~ #*#
  891. X+ 
  892. X+ # If you are using GNU make, the following statement will cause it to
  893. X+ # ignore any (bogus) files named `clean', `all', etc.; if you are using
  894. X+ # the standard Sun or bsd make, it won't hurt anything...
  895. X+ #
  896. X+ .PHONY: clean veryclean install all
  897. X*** /tmp/,RCSt1a18697    Fri Aug 11 07:44:25 1989
  898. X--- Bugs    Fri Aug 11 07:42:31 1989
  899. X***************
  900. X*** 7,12
  901. X  2) Arrow display messes up on rare occasions.  I haven't duplicated
  902. X     this often enough to track down.
  903. X  
  904. X  
  905. X  If you fix any of these, or spot other bugs, please let me know.
  906. X  
  907. X
  908. X--- 7,15 -----
  909. X  2) Arrow display messes up on rare occasions.  I haven't duplicated
  910. X     this often enough to track down.
  911. X  
  912. X+ The following bugs have been reported by various users, but I haven't
  913. X+ been able to fix them, since I haven't been able to duplicate them
  914. X+ (usually due to hardware/os combinations I don't have access to).
  915. X  
  916. X  *Calentool dies (seg fault) after running overnight with lockscreen <mfeblowitz@ge.com>
  917. X  *Core dump when clicking MS-MIDDLE button on note section on 386i <jmc@ptsfa.pacbell.com>
  918. X***************
  919. X*** 8,13
  920. X     this often enough to track down.
  921. X  
  922. X  
  923. X  If you fix any of these, or spot other bugs, please let me know.
  924. X  
  925. X          Bill Randle
  926. X
  927. X--- 11,23 -----
  928. X  been able to fix them, since I haven't been able to duplicate them
  929. X  (usually due to hardware/os combinations I don't have access to).
  930. X  
  931. X+ *Calentool dies (seg fault) after running overnight with lockscreen <mfeblowitz@ge.com>
  932. X+ *Core dump when clicking MS-MIDDLE button on note section on 386i <jmc@ptsfa.pacbell.com>
  933. X+ *Memory leakage <vicorp!sparky!scott@uunet.uu.net>
  934. X+ *Popup error window only gets partially displayed (OS 4.0.3/Sun3) <rohit@sun.com>
  935. X+ ?Deleting single occurrance of multiple meeting doesn't really delete it <ecm@aloft.uucp>
  936. X+ ?Running calentool forces icon gravity change on 386i <lwv27%chemabs@cis.ohio-state.edu>
  937. X+ 
  938. X  If you fix any of these, or spot other bugs, please let me know.
  939. X  
  940. X          Bill Randle
  941. X***************
  942. X*** 13,16
  943. X          Bill Randle
  944. X          billr@saab.CNA.TEK.COM
  945. X          {most backbones}!tektronix!saab.CNA.TEK!billr
  946. X!         May 10, 1989
  947. X
  948. X--- 23,26 -----
  949. X          Bill Randle
  950. X          billr@saab.CNA.TEK.COM
  951. X          {most backbones}!tektronix!saab.CNA.TEK!billr
  952. X!         August 11, 1989
  953. X*** /tmp/,RCSt1a18717    Fri Aug 11 07:48:18 1989
  954. X--- ToDo    Fri Aug 11 07:42:50 1989
  955. X***************
  956. X*** 4,6
  957. X     View2 may be the way to do this.
  958. X  
  959. X  2) Add Lunar based (e.g. Chinese, Japanese) holidays.
  960. X
  961. X--- 4,39 -----
  962. X     View2 may be the way to do this.
  963. X  
  964. X  2) Add Lunar based (e.g. Chinese, Japanese) holidays.
  965. X+ 
  966. X+ 3) Add calculations for more astronomical events.
  967. X+ 
  968. X+ 4) Convert display canvas to scrollable canvas to allow longer
  969. X+    time periods.
  970. X+ 
  971. X+ 5) Extend next and previous menus.
  972. X+ 
  973. X+ 3, 4 and 5, at least, will be in version 2.2....
  974. X+ 
  975. X+ The following feature enhancements have been suggested by various
  976. X+ users. Some of these may appear in version 2.2, some may not. Feel
  977. X+ free to send me your suggestions, or to vote on the ones listed
  978. X+ here.
  979. X+ 
  980. X+ =Add menu to Filename: option, add flags to #include directive to
  981. X+  indicate a)if name should appear in Filename: menu, b) read/write
  982. X+  default, c) string to appear in Filename: menu; <jcn@neptune.uucp>
  983. X+ =Long months don't fit on year listing <mcneill%eplrx7@uunet.uu.net>, <rwolff@noao.edu>
  984. X+ =Want Next and Previous menus to display multiple date selections <
  985. X+ =Want Quit and Close buttons <phil@grumpy.cgrg.ohio-state.edu>, <mcneill%eplrx7@uunet.uu.net>, <rohit@sun.com>
  986. X+ =Want command line option to set start and end time <brooks@ge-dab.ge.com>
  987. X+ =Want easy switch between different users appts <ptraynor@bbn.com>
  988. X+ =Want long days (really scrollable day) <syd@dsi.com>
  989. X+ =Want range of dates for printing <ian@sq.com>
  990. X+ =Want to be able to set START_HOUR > END_HOUR <sga@dip.eecs.umich.edu>
  991. X+ =Want to come up in week display <bob@boulder.colorado.edu>
  992. X+ =Want to order the notes (i.e. pick which is displayed first) <dna@emmy.umd.edu>
  993. X+ =Want to see two days at a time <rohit@sun.com>
  994. X+ =Want to set duration of an appointment (e.g. gone for 4 days) <jeremy@kheops.cmi.no>
  995. X+ =Want to start arbitrary process at appt time <wyle@inf.ethz.ch>
  996. X+ =Want week display to show current day at left, then next 5-7 days <bob@boulder.colorado.edu>
  997. X+ =Want window to open when appt time approaches <rohit@sun.com>
  998. END_OF_FILE
  999. if test 26414 -ne `wc -c <'patches04c'`; then
  1000.     echo shar: \"'patches04c'\" unpacked with wrong size!
  1001. fi
  1002. # end of 'patches04c'
  1003. fi
  1004. if test -f 'pcal.c' -a "${1}" != "-c" ; then 
  1005.   echo shar: Will not clobber existing file \"'pcal.c'\"
  1006. else
  1007. echo shar: Extracting \"'pcal.c'\" \(14965 characters\)
  1008. sed "s/^X//" >'pcal.c' <<'END_OF_FILE'
  1009. X/*
  1010. X * $Header: pcal.c,v 2.3 89/09/19 05:59:27 billr Exp $
  1011. X */
  1012. X/*
  1013. X * pcal - print pretty PostScript image of a month calendar
  1014. X *
  1015. X * Pieces extracted from the pcal program by Ken Keirnan and modified
  1016. X * slightly by Bill Randle, Tektronix, Inc. <billr@saab.CNA.TEK.COM>.
  1017. X * 
  1018. X * "Pcal" is a program to print PostScript calendars for any month and year.
  1019. X * Pcal is the combined effort of several people, most notably Patrick Wood
  1020. X * of Pipeline Associates, Inc. for the original PostScript code and Bill
  1021. X * Vogel of AT&T for the calendar file mechanism.  My part was simple
  1022. X * translation to a "C" program, the addition of a couple options and a more
  1023. X * generalized date searching routine (oh yes, and a manual page :-).
  1024. X * 
  1025. X * The original calendar PostScript was Copyright (c) 1987 by Patrick Wood
  1026. X * and Pipeline Associates, Inc. with permission to modify and redistribute.
  1027. X * 
  1028. X * Ken Keirnan
  1029. X * Pacific Bell
  1030. X * San Ramon, CA.
  1031. X *
  1032. X * Changes and additions Copyright (C) 1989 Tektronix, Inc.
  1033. X *    All Rights Reserved
  1034. X * Permission is hereby granted to use and modify the modifications in source
  1035. X * or binary form as long as they are not sold for profit and this copyright
  1036. X * notice remains intact.
  1037. X *
  1038. X * Modified by PM Lashley, KLA Instruments, Inc.
  1039. X * Fixes and extentions:                1..2 June, 1989
  1040. X *    1. Notes were extending beyond the right and bottom edges of the day.
  1041. X *       They are now line-wrapped with indentation.
  1042. X *    3. Bottom justify notes for each day.  Truncate if there are too many
  1043. X *       to fit.
  1044. X *    3. If month starts on a Wednesday or later, put the previous/next
  1045. X *       month inserts in the first two day boxes instead of the last two.
  1046. X *    4. Center the month inserts vertically in the day box.
  1047. X *    5. When possible, draw the calendar in a 5x7 grid instead of a 6x7
  1048. X *       grid.  Each day will be taller, and accomodate more note text.
  1049. X *    6. Added various comments to the Postscript code array.
  1050. X *    7. If a periodic event was removed for given occurance, that event
  1051. X *       would be printed twice when it should not be printed at all.
  1052. X *    8. Replaced the constant "Helvetica-Narrow" with PS_NOTE_FONT for
  1053. X *       sites which do not have the Helvetica-Narrow font but do have
  1054. X *       some preference other than the default.
  1055. X *
  1056. X * Left to do:
  1057. X *    1. If a 31 day month starts on Tuesday, the previous month should
  1058. X *       be in the upper left, and the next month in the lower right.
  1059. X *       This may be more trouble than it is worth.
  1060. X *
  1061. X * Notes:
  1062. X *    1. The Postscript code layout is a compromise between readability
  1063. X *       and compaction.  All comments and vertical spacing are in the
  1064. X *       c source only to keep the output file size small.
  1065. X *
  1066. X * Further changes and additions Copyright (C) 1989 PM Lashley
  1067. X *    All Rights Reserved
  1068. X * Permission is hereby granted to use and modify the modifications in source
  1069. X * or binary form as long as they are not sold for profit and this copyright
  1070. X * notice remains intact.
  1071. X *
  1072. X */
  1073. X#include "ct.h"
  1074. X
  1075. X#include <stdio.h>
  1076. X#include <time.h>
  1077. X
  1078. Xextern struct tm current, First;
  1079. Xextern struct dayslot slots[];
  1080. Xextern int get_day_appts();
  1081. X
  1082. X/*
  1083. X * pheader - provides the PostScript routines
  1084. X */
  1085. Xchar *pheader[] = {
  1086. X    "%!",
  1087. X    "%%Creator: Pipeline Associates",
  1088. X    "%%Title: calentool's month-at-a-glance",
  1089. X    "%%Modifed: Ken Keirnan, Bill Randle, PM Lashley and Richard Wolff",
  1090. X    "%%DocumentFonts: Times-Bold Helvetica-Bold Helvetica-Narrow",
  1091. X    "%%Pages: 1",
  1092. X    "%%EndComments",
  1093. X    "/titlefont /Times-Bold def",
  1094. X    "/dayfont /Helvetica-Bold def",
  1095. X    "/month_names [ (January) (February) (March) (April) (May) (June) (July)",
  1096. X    "  (August) (September) (October) (November) (December) ] def",
  1097. X    "/prtnum { 3 string cvs show} def",
  1098. X    /*
  1099. X     * -  -weeks-  int
  1100. X     *
  1101. X     * Pushes the number of week lines (rows) necessary for the current month.
  1102. X     */
  1103. X    "/weeks {",
  1104. X    "  startday ndays add 35 gt { 6 } { 5 } ifelse",
  1105. X    "} def",
  1106. X
  1107. X    /*
  1108. X     * -  -monthHeight-  int
  1109. X     *
  1110. X     * Pushes the height of an individual day box for the current month.
  1111. X     */
  1112. X    "/monthHeight { weeks 5 eq { 96 } { 80 } ifelse } def",
  1113. X
  1114. X    /*
  1115. X     * Draw the day names and the grid for the current month
  1116. X     */
  1117. X    "/drawgrid {",
  1118. X    "  dayfont findfont 10 scalefont setfont",
  1119. X    "  0 1 6 {",
  1120. X    "    dup dup 100 mul 40 moveto",
  1121. X    "    [  (Sunday) (Monday) (Tuesday) (Wednesday)",
  1122. X    "      (Thursday) (Friday) (Saturday) ]",
  1123. X    "    exch get",
  1124. X    "    100 center",
  1125. X    "    100 mul 35 moveto",
  1126. X    "    1.0 setlinewidth",
  1127. X    "    0 1 weeks 1 sub {",
  1128. X    "      gsave",
  1129. X    "        100 0 rlineto",
  1130. X    "        0 monthHeight neg rlineto",
  1131. X    "        -100 0 rlineto",
  1132. X    "        closepath stroke",
  1133. X    "      grestore",
  1134. X    "      0 monthHeight neg rmoveto",
  1135. X    "    } for",
  1136. X    "  } for",
  1137. X    "} def",
  1138. X
  1139. X    /*
  1140. X     * Draw in the day numbers for each day of the current month.
  1141. X     *
  1142. X     * Sunday (and possibly Saturday) will be gray.
  1143. X     */
  1144. X    "/drawnums {",
  1145. X    "  dayfont findfont 30 scalefont setfont",
  1146. X    "  /start startday def",
  1147. X    "  /days ndays def",
  1148. X    "  start 100 mul 5 add 10 rmoveto",
  1149. X    "  1 1 days {",
  1150. X    "    /day exch def",
  1151. X    "    gsave",
  1152. X#ifndef SATBLK
  1153. X    "      day start add 7 mod 0 eq {",
  1154. X    "        submonth 0 eq { .8 setgray } if",
  1155. X    "      } if",
  1156. X#endif
  1157. X    "      day start add 7 mod 1 eq {",
  1158. X    "        submonth 0 eq { .8 setgray } if",
  1159. X    "      } if",
  1160. X    "      day prtnum",
  1161. X    "    grestore",
  1162. X    "    day start add 7 mod 0 eq",
  1163. X    "    { currentpoint exch pop monthHeight sub 5 exch moveto }",
  1164. X    "    { 100 0 rmoveto }",
  1165. X    "    ifelse",
  1166. X    "  } for",
  1167. X    "} def",
  1168. X
  1169. X    /*
  1170. X     * Gray out the day boxes before the first day of the month and after
  1171. X     * the last day of the month.  If this is not a submonth, leave two
  1172. X     * blank for the previous and next month miniature calendars.
  1173. X     */
  1174. X    "/drawfill {",
  1175. X    "  /start startday def",
  1176. X    "  1.0 setlinewidth",
  1177. X    "  submonth 1 eq {",
  1178. X    "   0 35 rmoveto",
  1179. X    "   /grayWidth start 100 mul def",
  1180. X    "   /lastday 7 def",
  1181. X    "  } {",
  1182. X    "   start 3 ge {",
  1183. X    "     200 35 rmoveto",
  1184. X    "     /grayWidth start 2 sub 100 mul def",
  1185. X    "     /lastday 7 def",
  1186. X    "   } {",
  1187. X    "     0 35 rmoveto",
  1188. X    "     /grayWidth start 100 mul def",
  1189. X    "     /lastday 5 def",
  1190. X    "   } ifelse",
  1191. X    "  } ifelse",
  1192. X    "  grayWidth 0 gt {",
  1193. X    "   gsave",
  1194. X    "     .9 setgray",
  1195. X    "     grayWidth 0 rlineto",
  1196. X    "     0 monthHeight neg rlineto",
  1197. X    "     grayWidth neg 0 rlineto",
  1198. X    "     closepath fill",
  1199. X    "   grestore",
  1200. X    "  } if",
  1201. X    "  /endday startday ndays add 7 mod def",
  1202. X    "  endday 0 ne {",
  1203. X    "   ndays startday add 7 mod 100 mul",
  1204. X    "   weeks 1 sub neg monthHeight mul 35 add moveto",
  1205. X    "   /grayWidth lastday 100 mul currentpoint pop sub def",
  1206. X    "   grayWidth 0 gt {",
  1207. X    "    gsave",
  1208. X    "      .9 setgray",
  1209. X    "      grayWidth 0 rlineto",
  1210. X    "      0 monthHeight neg rlineto",
  1211. X    "      grayWidth neg 0 rlineto",
  1212. X    "      closepath fill",
  1213. X    "    grestore",
  1214. X    "   } if",
  1215. X    "  } if",
  1216. X    "} def",
  1217. X
  1218. X    "/isleap {",
  1219. X    "  year 4 mod 0 eq",
  1220. X    "  year 100 mod 0 ne",
  1221. X    "  year 1000 mod 0 eq or and",
  1222. X    "} def",
  1223. X
  1224. X    "/days_month [ 31 28 31 30 31 30 31 31 30 31 30 31 ] def",
  1225. X
  1226. X    /*
  1227. X     * -  -ndays-  int
  1228. X     *
  1229. X     * Push number of days in current month.  Account for leap February.
  1230. X     */
  1231. X    "/ndays {",
  1232. X    "  days_month month 1 sub get",
  1233. X    "  month 2 eq",
  1234. X    "  isleap and { 1 add } if",
  1235. X    "} def",
  1236. X
  1237. X    /*
  1238. X     * -  -startday-  int
  1239. X     *
  1240. X     * Push the day of the week on which the first of the current month falls.
  1241. X     */
  1242. X    "/startday {",
  1243. X    "  /off year 2000 sub def",
  1244. X    "  off",
  1245. X    "  off 4 idiv add",
  1246. X    "  off 100 idiv sub",
  1247. X    "  off 1000 idiv add",
  1248. X    "  6 add 7 mod 7 add",
  1249. X    "  /off exch def",
  1250. X    "  1 1 month 1 sub {",
  1251. X    "    /idx exch def",
  1252. X    "    days_month idx 1 sub get",
  1253. X    "    idx 2 eq",
  1254. X    "    isleap and",
  1255. X    "    { 1 add } if",
  1256. X    "    /off exch off add def",
  1257. X    "  } for",
  1258. X    "  off 7 mod",
  1259. X    "} def",
  1260. X
  1261. X    "/center {",
  1262. X    "  /width exch def",
  1263. X    "  /str exch def width str ",
  1264. X    "  stringwidth pop sub 2 div 0 rmoveto str show",
  1265. X    "} def",
  1266. X
  1267. X    /*
  1268. X     * Draw an entire month calendar.
  1269. X     * (Without any previous/next subcalendars.)
  1270. X     */
  1271. X    "/calendar",
  1272. X    "{",
  1273. X    "  titlefont findfont 48 scalefont setfont",
  1274. X    "  0 60 moveto",
  1275. X    "  /month_name month_names month 1 sub get def",
  1276. X    "  month_name show",
  1277. X    "  /yearstring year 10 string cvs def",
  1278. X    "  700 yearstring stringwidth pop sub 60 moveto",
  1279. X    "  yearstring show",
  1280. X    "  0 0 moveto",
  1281. X    "  drawnums",
  1282. X    "  0 0 moveto",
  1283. X    "  drawfill",
  1284. X    "  0 0 moveto",
  1285. X    "  drawgrid",
  1286. X    "} def",
  1287. X
  1288. X    /*
  1289. X     * array-of-notes  -daytext-  -
  1290. X     */
  1291. X    "/daytext {",
  1292. X    "  /mytext exch def /myday exch def",
  1293. X    "  /bottom monthHeight 30 sub def",
  1294. X    "  startday myday 1 sub add dup",
  1295. X    "  7 mod 100 mul 5 add /LM exch def",
  1296. X    "  7 idiv monthHeight neg mul /ylimit exch def",
  1297. X    "  ylimit bottom sub /ypos exch def",
  1298. X    "  /RM LM 95 add def /ystart ypos def",
  1299. X    "  mytext {",
  1300. X    "    95 90 { pop pop /ystart ystart 8 add def } breakIntoLines",
  1301. X    "    ystart ylimit le { /ypos ystart def } if",
  1302. X    "  } forall",
  1303. X    "  /ylimit ylimit bottom sub def",
  1304. X    "  mytext { 95 90 { prstr } breakIntoLines } forall",
  1305. X    "} def",
  1306. X
  1307. X    /*
  1308. X     * string maxwidth  -prstr-  -
  1309. X     */
  1310. X    "/prstr {",
  1311. X    "  ypos ylimit gt {",
  1312. X    "    RM exch sub ypos moveto show",
  1313. X    "    /ypos ypos 8 sub def",
  1314. X    "  } {",
  1315. X    "   pop pop",
  1316. X    "  } ifelse",
  1317. X    "} def",
  1318. X
  1319. X    /*
  1320. X     * Word break string for breakIntoLines.
  1321. X     */
  1322. X    "/space ( ) def",
  1323. X
  1324. X    /*
  1325. X     * string  first-width  next-width  proc  -breakIntoLines-  -
  1326. X     *
  1327. X     * Break the string into lines.  The first line will fit within
  1328. X     * first-width.  Later lines will fit within next-width.  For each
  1329. X     * line, push the string and current width then execute proc.
  1330. X     *
  1331. X     * This is a modification of the function listed in the Blue book
  1332. X     * (Postscript Language Tutorial and Cookbook, Adobe Systems, Inc.).
  1333. X     * The modifications are:
  1334. X     *    1.    The addition of the next-width parameter to handle indentation.
  1335. X     *  2.    The original would not break the line if only the last word
  1336. X     *        extended beyond the limit.
  1337. X     */
  1338. X    "/breakIntoLines {",
  1339. X    "  /proc exch def",
  1340. X    "  /nextlinewidth exch def",
  1341. X    "  /linewidth exch def",
  1342. X    "  /textstring exch def",
  1343. X    "  /breakwidth space stringwidth pop def",
  1344. X    "  /curwidth 0 def",
  1345. X    "  /lastwordbreak 0 def",
  1346. X    "  /startchar 0 def",
  1347. X    "  /restoftext textstring def",
  1348. X    "  {",
  1349. X    "   restoftext space search {",
  1350. X    "     /nextword exch def pop",
  1351. X    "     /restoftext exch def",
  1352. X    "      /wordwidth nextword stringwidth pop def",
  1353. X    "      curwidth wordwidth add linewidth gt {",
  1354. X    "           textstring startchar",
  1355. X    "        lastwordbreak startchar sub",
  1356. X    "        getinterval linewidth proc",
  1357. X    "        /startchar lastwordbreak def",
  1358. X    "        /curwidth wordwidth breakwidth add def",
  1359. X    "           /linewidth nextlinewidth def",
  1360. X    "      } {",
  1361. X    "           /curwidth curwidth wordwidth add breakwidth add def",
  1362. X    "     } ifelse",
  1363. X    "      /lastwordbreak lastwordbreak nextword length add 1 add def",
  1364. X    "    } {",
  1365. X    "     stringwidth pop curwidth add linewidth gt {",
  1366. X    "           textstring startchar",
  1367. X    "           lastwordbreak startchar sub",
  1368. X    "           getinterval linewidth proc",
  1369. X    "        /startchar lastwordbreak def",
  1370. X    "           /linewidth nextlinewidth def",
  1371. X    "     } if",
  1372. X    "     exit",
  1373. X    "   }",
  1374. X    "    ifelse",
  1375. X    "  } loop",
  1376. X    "  /lastchar textstring length def",
  1377. X    "  textstring startchar lastchar startchar sub getinterval linewidth proc",
  1378. X    "} def",
  1379. X
  1380. X    "/printmonth {",
  1381. X    "  90 rotate",
  1382. X    "  50 -120 translate",
  1383. X    "  /submonth 0 def",
  1384. X    "  calendar",
  1385. X    "  month 1 sub 0 eq {",
  1386. X    "    /lmonth 12 def",
  1387. X    "    /lyear year 1 sub def",
  1388. X    "  } {",
  1389. X    "    /lmonth month 1 sub def",
  1390. X    "    /lyear year def",
  1391. X    "  } ifelse",
  1392. X    "  month 1 add 13 eq {",
  1393. X    "    /nmonth 1 def",
  1394. X    "    /nyear year 1 add def",
  1395. X    "  } {",
  1396. X    "    /nmonth month 1 add def",
  1397. X    "    /nyear year def",
  1398. X    "  } ifelse",
  1399. X    "  /savemonth month def",
  1400. X    "  /saveyear year def",
  1401. X    "  /submonth 1 def",
  1402. X    "  gsave",
  1403. X    "    /offset monthHeight 80 sub 2 div neg 35 add def",
  1404. X    "    startday 3 lt",
  1405. X    "    { 500 weeks 1 sub neg monthHeight mul offset add translate }",
  1406. X    "    { 0  offset translate }",
  1407. X    "    ifelse",
  1408. X    "   /year lyear def",
  1409. X    "   /month lmonth def",
  1410. X    "    gsave",
  1411. X    "      .138 .138 scale",
  1412. X    "      10 -120 translate",
  1413. X    "      calendar",
  1414. X    "    grestore",
  1415. X    "    /submonth 1 def",
  1416. X    "    /year nyear def",
  1417. X    "    /month nmonth def",
  1418. X    "    100 0 translate",
  1419. X    "    gsave",
  1420. X    "      .138 .138 scale",
  1421. X    "      10 -120 translate",
  1422. X    "      calendar",
  1423. X    "    grestore",
  1424. X    "    /month savemonth def",
  1425. X    "    /year saveyear def",
  1426. X    "    /submonth 0 def",
  1427. X    "  grestore",
  1428. X    "} def",
  1429. X  (char *)0,
  1430. X};
  1431. X
  1432. Xprint_month(fp, noteflag)
  1433. XFILE *fp;
  1434. Xint noteflag;
  1435. X{
  1436. X    char      **ap;
  1437. X    int        i;
  1438. X
  1439. X    
  1440. X    /*
  1441. X     * Write out PostScript prolog
  1442. X     */
  1443. X    for (ap = pheader; *ap; ap++)
  1444. X    fprintf(fp, "%s\n", *ap);
  1445. X
  1446. X    /*
  1447. X     * Do the calendar
  1448. X     */
  1449. X    fprintf (fp, "/year %d def\n", current.tm_year+1900);
  1450. X    fprintf (fp, "/month %d def\n", current.tm_mon+1);
  1451. X    fprintf (fp, "printmonth\n");
  1452. X
  1453. X    /*
  1454. X     * Set the font here to reduce the number of complainings if
  1455. X     * it is not found.
  1456. X     */
  1457. X    fprintf (fp, "/%s findfont 6 scalefont setfont\n", PS_NOTE_FONT);
  1458. X
  1459. X    First = current;
  1460. X    current.tm_mday = 1;
  1461. X    for (i=0; i<monthlength(current.tm_mon); i++) {
  1462. X    fix_current_day();
  1463. X    (void)get_day_appts();
  1464. X    print_mday(fp, noteflag);
  1465. X    current.tm_mday++;
  1466. X    }
  1467. X    current = First;
  1468. X
  1469. X    /*
  1470. X     * Write out PostScript postlog
  1471. X     */
  1472. X    fprintf(fp, "showpage\n");
  1473. X}
  1474. X
  1475. Xprint_mday(fp, noteflag)
  1476. XFILE *fp;
  1477. Xint noteflag;
  1478. X{
  1479. X    int     slotno;
  1480. X    struct appt_entry    *aptr, *optr;
  1481. X    
  1482. X    fprintf(fp, "%d [\n", current.tm_mday);
  1483. X
  1484. X    for (slotno=0; slotno<N_SLOTS; slotno++) {
  1485. X    /* any appts in this timeslot? */
  1486. X    if ((slots[slotno].active == ACTIVE) && slots[slotno].first) {
  1487. X        /* get printable string from each appt */
  1488. X        for (aptr=slots[slotno].first; aptr;) {
  1489. X        if (!deleted(aptr, slotno) && 
  1490. X            (!noteflag || ((aptr->flags & MARKED_NOTE) != MARKED_NOTE)))
  1491. X            fprintf(fp, "    (%s)\n", format_appt_nd(aptr, TRUE));
  1492. X        /* free up memory used */
  1493. X        optr = aptr;
  1494. X        aptr = aptr->next;
  1495. X        free(optr);
  1496. X        }
  1497. X    }
  1498. X    }
  1499. X    fprintf(fp, "] daytext\n");
  1500. X}
  1501. X
  1502. X/* check to see if appt pointed to by ap has been deleted */
  1503. Xint
  1504. Xdeleted(ap, bi)
  1505. Xstruct appt_entry *ap;
  1506. Xint bi;
  1507. X{
  1508. X    int found = 0;
  1509. X    struct appt_entry *a;
  1510. X
  1511. X    if (ap->flags & DELETED)
  1512. X        return(1);
  1513. X
  1514. X    /* run through the list to see if there are any deleted */
  1515. X    for (a=slots[bi].first; a; a=a->next)
  1516. X        if (a->flags & DELETED) {
  1517. X            /* now see if the current one matches */
  1518. X            if (!strcmp(a->str, ap->str))
  1519. X                return(1);
  1520. X        }
  1521. X    
  1522. X    return(0);
  1523. X}
  1524. END_OF_FILE
  1525. if test 14965 -ne `wc -c <'pcal.c'`; then
  1526.     echo shar: \"'pcal.c'\" unpacked with wrong size!
  1527. fi
  1528. # end of 'pcal.c'
  1529. fi
  1530. echo shar: End of archive 3 \(of 4\).
  1531. cp /dev/null ark3isdone
  1532. MISSING=""
  1533. for I in 1 2 3 4 ; do
  1534.     if test ! -f ark${I}isdone ; then
  1535.     MISSING="${MISSING} ${I}"
  1536.     fi
  1537. done
  1538. if test "${MISSING}" = "" ; then
  1539.     echo You have unpacked all 4 archives.
  1540.     rm -f ark[1-9]isdone
  1541. else
  1542.     echo You still need to unpack the following archives:
  1543.     echo "        " ${MISSING}
  1544. fi
  1545. ##  End of shell archive.
  1546. exit 0
  1547.  
  1548.